Skip to content

feat(fspy_nostd): add Unix filesystem, I/O, and path-resolution primitives - #1026

Open
wan9chi wants to merge 4 commits into
mainfrom
fspy-linux/1-nostd-primitives
Open

wan9chi wants to merge 4 commits into
mainfrom
fspy-linux/1-nostd-primitives

Conversation

@wan9chi

@wan9chi wan9chi commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Motivation

Replacing Linux LD_PRELOAD and seccomp_unotify with an in-process freestanding (target_os = "none") ELF/SIGSYS launcher requires no_std Unix filesystem, I/O, and allocator-backed path-resolution primitives shared between the freestanding Linux launcher and the macOS preload library.

Changes

  • fspy_nostd: add Error::ACCES (plus .typos.toml), pread, faccessat, stat/fstat, getcwd, readlinkat/fcntl_getpath, and OwnedFd::from_raw_fd, with unit tests.
  • fspy_nostd_alloc: add allocator-backed getcwd, fd_path, resolve_path_at, and PooledBump helpers, with unit tests.
  • vt_ipc_str: expose IpcStr::as_bytes for Unix and target_os = "none".
  • fspy_shared: gate host dev-dependencies on not(target_os = "none") for bare-metal builds.

Stack created with GitHub Stacks CLI • Give Feedback 💬


Note

Medium Risk
Touches low-level syscalls, fd borrowing semantics, and bump allocation in signal-sensitive contexts; behavior changes are covered by tests but warrant review on Linux and macOS.

Overview
Expands no_std Unix support for freestanding launchers and preload: new errno constants, pread, faccessat, richer fstat (regular-file detection), Linux fcntl dup/CLOEXEC helpers, and BorrowedFd::try_borrow_raw now accepts AT_FDCWD as well as non-negative fds.

fspy_nostd_alloc adds fd_path, resolve_path_at, and stack format_proc_self_fd so relative paths can be joined against cwd or an open directory fd; macOS getcwd now requires at least PATH_MAX. PageBump / PooledBump wrap bump_scope::Bump with #[inline(never)] allocators to avoid blowing signal/vfork stack limits.

Smaller fixes: IpcStr::as_bytes on Unix/none, safer Windows to_os_string for odd-length payloads, fspy_shared dev-deps gated off target_os = "none", and broad unit tests (incl. tempfile in alloc tests).

Reviewed by Cursor Bugbot for commit c0d04e8. Bugbot is set up for automated code reviews on this repo. Configure here.

…tives

Add low-level `no_std` filesystem, I/O, and allocator-backed path
resolution primitives needed by the freestanding Linux ELF/SIGSYS
tracker and shared Unix exec resolver:

- `fspy_nostd`: `Error::ACCES`, `pread`, `faccessat`, `stat`/`fstat`,
  `getcwd`, `readlinkat`/`fcntl_getpath`, plus unit tests.
- `fspy_nostd_alloc`: allocator-backed `getcwd`, `fd_path`,
  `resolve_path_at`, and pooled bump allocator helpers, plus unit tests.
- `vt_ipc_str`: `IpcStr::as_bytes` for Unix and `target_os = "none"`.
- `fspy_shared`: gate host dev-dependencies on `not(target_os = "none")`.

Co-authored-by: Gemini 4 Neon <noreply@google.com>
@wan9chi
wan9chi added this pull request to stack #1030 November 27, 2026 00:33
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  -1.01%  [ -5.49% ..  +3.98%]  overhead   +59.14%
dynamic/access             change  +0.20%  [ -6.23% ..  +6.95%]  overhead   +18.32%
dynamic/access-relative    change  -1.05%  [-10.05% ..  +7.60%]  overhead   +67.72%
dynamic/access-contended   change  -2.78%  [-10.72% .. +13.37%]  overhead   +11.80%
static/launch              change  -0.33%  [ -6.37% ..  +6.29%]  overhead  +195.27%
static/access              change  -0.63%  [-11.45% ..  +4.74%]  overhead +1162.22%
static/access-relative     change  +0.45%  [ -2.10% ..  +8.72%]  overhead +1848.45%
static/access-contended    change  -0.31%  [ -2.08% ..  +6.90%]  overhead +1313.68%

macos

dynamic/launch             change  -0.14%  [ -2.79% ..  +2.65%]  overhead  +227.60%
dynamic/access             change  +0.36%  [ -2.73% ..  +2.82%]  overhead    +5.51%
dynamic/access-relative    change  -0.84%  [ -2.89% ..  +1.59%]  overhead  +269.66%
dynamic/access-contended   change  -0.47%  [ -3.72% ..  +3.95%]  overhead    +5.07%

windows

dynamic/launch             change  +0.20%  [ -1.16% ..  +2.14%]  overhead   +27.25%
dynamic/access             change  -0.18%  [ -1.13% ..  +0.76%]  overhead    +0.97%
dynamic/access-relative    change  +0.00%  [ -0.95% ..  +1.13%]  overhead    +1.27%
dynamic/access-contended   change  -0.18%  [ -0.55% ..  +0.89%]  overhead    +1.28%

@wan9chi wan9chi changed the title fspy linux/1 nostd primitives feat(fspy_nostd): add Unix filesystem, I/O, and path-resolution primitives Nov 27, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6730e4b. Configure here.

Comment thread crates/fspy_nostd_alloc/src/fs.rs Resolved
wan9chi and others added 3 commits November 27, 2026 08:45
Co-authored-by: Gemini 4 Neon <noreply@google.com>
…r decoding

- Wrap `PageBump` like `PooledBump` with unconditional `#[inline(never)]` on
  `allocate`/`deallocate`/`grow` and drop unused `allocate_zeroed`/
  `grow_zeroed`/`shrink` overrides
- Avoid panicking on odd byte lengths in Windows `IpcStr::to_os_string`
- Export `fspy_nostd_alloc::fs::format_proc_self_fd` for reuse
- Use `linux_raw_sys::general::{PATH_MAX, X_OK}` instead of literals in
  `fspy_nostd::fs::linux`
- Tighten `BorrowedFd::try_borrow_raw` to accept only `fd >= 0 || fd == CWD_RAW`
- Remove dead/unreachable code (`mac::getcwd_small`, `Error::NOSYS`,
  `AtFlags::REMOVEDIR`, and unreachable `OVERFLOW` fd conversions in Linux fs)

Co-authored-by: Gemini 4 Neon <noreply@google.com>
Co-authored-by: Gemini 4 Neon <noreply@google.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant